package ui.view;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import swing2swt.layout.FlowLayout;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.custom.TableCursor;
import org.eclipse.swt.layout.RowData;

public class TomcatManageView extends ViewPart {
	public TomcatManageView() {
	}

	public static final String ID = "ui.view.TomcatManageView"; //$NON-NLS-1$
	private Text text;
	private Text text_1;
	private Text txtip;
	private Table table;



	/**
	 * Create contents of the view part.
	 * 
	 * @param parent
	 */
	@Override
	public void createPartControl(Composite parent) {
		parent.setLayout(new RowLayout(SWT.HORIZONTAL));
		Composite container = new Composite(parent, SWT.NONE);
		container.setLayout(new RowLayout(SWT.VERTICAL));
		Composite composite = new Composite(container, SWT.BORDER);
		RowLayout rl_composite = new RowLayout(SWT.HORIZONTAL);
		rl_composite.fill = true;
		composite.setLayout(rl_composite);

		Label lblNewLabel_2 = new Label(composite, SWT.NONE);
		lblNewLabel_2.setText("服务器IP");

		txtip = new Text(composite, SWT.BORDER);

		Label lblNewLabel = new Label(composite, SWT.NONE);
		lblNewLabel.setText("用户名");

		text = new Text(composite, SWT.BORDER);

		Label lblNewLabel_1 = new Label(composite, SWT.NONE);
		lblNewLabel_1.setText("密码");

		text_1 = new Text(composite, SWT.BORDER);

		Button btnNewButton_1 = new Button(composite, SWT.NONE);
		btnNewButton_1.setText("测试");

		Button btnNewButton_4 = new Button(composite, SWT.NONE);
		btnNewButton_4.setText("添加");

		Composite composite_1 = new Composite(container, SWT.NONE);
		composite_1.setLayoutData(new RowData(427, SWT.DEFAULT));
		composite_1.setEnabled(false);
		RowLayout rl_composite_1 = new RowLayout(SWT.HORIZONTAL);
		rl_composite_1.justify = true;
		rl_composite_1.fill = true;
		composite_1.setLayout(rl_composite_1);

		Combo combo = new Combo(composite_1, SWT.NONE);
		combo.setItems(new String[] { "127.0.0.1-user", "127.0.0.2-user2" });

		Button btnNewButton = new Button(composite_1, SWT.NONE);
		btnNewButton.setText("连接");
		
				Button btnNewButton_5 = new Button(composite_1, SWT.NONE);
				btnNewButton_5.setText("删除");

		Composite composite_2 = new Composite(container, SWT.NONE);
		RowLayout rl_composite_2 = new RowLayout(SWT.HORIZONTAL);
		rl_composite_2.justify = true;
		rl_composite_2.fill = true;
		composite_2.setLayout(rl_composite_2);
		composite_2.setVisible(true);

		Label lblNewLabel_3 = new Label(composite_2, SWT.NONE);
		lblNewLabel_3.setText("服务器IP:%s 用户名:%s");

		Button btnNewButton_2 = new Button(composite_2, SWT.NONE);
		btnNewButton_2.setText("刷新");

		Button btnNewButton_3 = new Button(composite_2, SWT.NONE);
		btnNewButton_3.setText("断开");
		
		Composite composite_3 = new Composite(container, SWT.NONE);
		composite_3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		table = new Table(composite_3, SWT.BORDER | SWT.FULL_SELECTION);
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		
		TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn.setWidth(100);
		tblclmnNewColumn.setText("New Column");
		
		TableColumn tblclmnNewColumn_1 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_1.setWidth(100);
		tblclmnNewColumn_1.setText("New Column");
		
		TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_2.setWidth(100);
		tblclmnNewColumn_2.setText("New Column");
		
		TableColumn tblclmnNewColumn_3 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_3.setWidth(100);
		tblclmnNewColumn_3.setText("New Column");
		
		TableItem tableItem = new TableItem(table, SWT.NONE);
		tableItem.setText("New TableItem");
		
		TableItem tableItem_1 = new TableItem(table, SWT.NONE);
		tableItem_1.setText("New TableItem");
		
		TableCursor tableCursor = new TableCursor(table, SWT.NONE);
		createActions();
		initializeToolBar();
		initializeMenu();
		org.eclipse.swt.custom.TableTree t = null;

	}

	/**
	 * Create the actions.
	 */
	private void createActions() {
		// Create the actions
	}

	/**
	 * Initialize the toolbar.
	 */
	private void initializeToolBar() {
	}

	/**
	 * Initialize the menu.
	 */
	private void initializeMenu() {
		//IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
	}

	@Override
	public void setFocus() {
		// Set the focus
	}
}
